export default {
    namespaced: true,
    state: {
        videoList: [],
        curVideoName: '',
        pathList: [],
        spinning: false,
        categoryList: [],
        dontAsk: {},
    },
    mutations: {
        setVideoList(state, payload) {
            state.videoList = payload
        },
        setCurVideoName(state, payload) {
            state.curVideoName = payload
        },
        setPathList(state, payload) {
            state.pathList = payload
        },
        setSomeVideo(state, payload) {
            for (const video of payload) {
                const i = state.videoList.findIndex((item) => item.key === video.key)
                if (i > -1) {
                    state.videoList[i] = video
                }
            }
        },
        setSpinning(state, payload) {
            state.spinning = payload
        },
        setCategoryList(state, payload) {
            state.categoryList = payload
        },
        setDontAsk(state, payload) {
            state.dontAsk = payload
        },
    },
    actions: {
        setVideoList(ctx, payload) {
            ctx.commit('setVideoList', payload)
        },
    },
}
